package com.cn.kehong.controller;


import com.cn.kehong.api.*;
import com.cn.kehong.domain.*;
import com.cn.kehong.utils.JsonResponse;
import com.cn.kehong.utils.QueryForm;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/bigScreen")
public class BIgScreenController {

    @Autowired
    private IProductPeiTouService productPeiTouService;

    @Autowired
    private IProductThinPeriodService productThinPeriodService;
    @Autowired
    private IProductThickPeriodService productThickPeriodService;
    @Autowired
    private IProductChuciPeriodService productChuciPeriodService;

    @Autowired
    private IProductGzPeriodService productGzPeriodService;

    @Autowired
    private IProductSaojiePeriodService productSaojiePeriodService;
    @Autowired
    private IProductDianciPeriodService productDianciPeriodService;
    @Autowired
    private IThroughRateService throughRateService;
    @Autowired private ILineTaskService iLineTaskService;
    @Autowired
    private IEnergyService iEnergyService;
    @Autowired
    private IDataSubmissionKbService dataSubmissionKbService;
    @Autowired
    private IPowRateDetailService powRateDetailService;
    //制程直通率
    @RequestMapping("/getDataListByKb")
    @ResponseBody
    public JsonResponse<List<ThroughRateVo>> getThroughRateVoList(QueryForm queryForm) throws Exception {
        JsonResponse<List<ThroughRateVo>> response = new JsonResponse<List<ThroughRateVo>>();
        List<ThroughRateVo> list  = throughRateService.getThroughRateVoListByKb(queryForm);
        response.setResult(list);
        response.setSuccess(true);
        return  response;
    }

    //原材料品控合格率/产品合格率/不良品分析
    @RequestMapping("/getAnalysisListByKb")
    @ResponseBody
    public JsonResponse<List<DataSubmissionVo>> getAnalysisListByKb(QueryForm queryForm) throws Exception {
        JsonResponse<List<DataSubmissionVo>> response = new JsonResponse<List<DataSubmissionVo>>();
        List<DataSubmissionVo> list  = dataSubmissionKbService.getAnalysisListByKb(queryForm);
        response.setResult(list);
        response.setSuccess(true);
        return  response;
    }


    //品控作业动态
    @RequestMapping("/getPkListByKb")
    @ResponseBody
    public JsonResponse<Map<String, Object>> getPkListByKb(QueryForm queryForm)
            throws Exception {
        JsonResponse<Map<String, Object>> response = new JsonResponse<Map<String, Object>>();
        Map<String, Object> lineTasks = iLineTaskService.getPkListByKb(queryForm);
        response.setResult(lineTasks);
        response.setSuccess(true);
        return response;
    }



    //今日产线产能
    @RequestMapping("/getCapacityByKb")
    @ResponseBody
    public JsonResponse<List<PowRateDetail>> getCapacityByKb(QueryForm queryForm) throws Exception {
        JsonResponse<List<PowRateDetail>> response = new JsonResponse<List<PowRateDetail>>();
        List<PowRateDetail> list  = powRateDetailService.getCapacityByKb(queryForm);
        response.setResult(list);
        response.setSuccess(true);
        return  response;
    }

    //能源接口
    @RequestMapping("/getEnergyListByKb")
    @ResponseBody
    public JsonResponse<Map<String, Object>> getEnergyListByKb(QueryForm queryForm)
            throws Exception {
        JsonResponse<Map<String, Object>> response = new JsonResponse<Map<String, Object>>();
        Map<String, Object> energyListByKb = iEnergyService.getEnergyListByKb(queryForm);
        response.setResult(energyListByKb);
        response.setSuccess(true);
        return response;
    }


    //年度计划/原辅料当月动态/原辅料即时库存/今日发货动态
    @RequestMapping("/getAnalysisListByYy")
    @ResponseBody
    public JsonResponse<List<DataSubmissionVo>> getAnalysisListByYy(QueryForm queryForm) throws Exception {
        JsonResponse<List<DataSubmissionVo>> response = new JsonResponse<List<DataSubmissionVo>>();
        List<DataSubmissionVo> list  = dataSubmissionKbService.getAnalysisListByYy(queryForm);
        response.setResult(list);
        response.setSuccess(true);
        return  response;
    }
}
